using System;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetNuke;
using DotNetNuke.Common;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Localization;
using DotNetNuke.Services.Exceptions;
using gdlmo.DNN.Modules.Informations.Business;

namespace gdlmo.DNN.Modules.Informations
{
	public abstract class InformationsList : PortalModuleBase
	{
		protected System.Web.UI.WebControls.HyperLink lnkMore;
		protected System.Web.UI.HtmlControls.HtmlTable tbmore;
		protected System.Web.UI.WebControls.Repeater rptInfos;		
	
		#region Private Function
		protected int GetMaxChars()
		{
			int MaxChars = 10;
			if (Settings["MaxChars"]!=null)
			{
				if(gdlmo.Common.StringHelper.IsNum(Settings["MaxChars"].ToString()))	MaxChars = Int32.Parse(Settings["MaxChars"].ToString());
				else MaxChars = 10;
			}
			return MaxChars;
		}	
		
		protected void BindList()
		{
			InformationsController objCtlInfo = new InformationsController();
			
			int pcount=0;
			ArrayList list = objCtlInfo.GetPagingData(0,10,ref pcount);
			rptInfos.DataSource = list;			//objCtlInfo.GetPagingData(this.PageIndex,this.PageSize,ref pcount);
			
			
			rptInfos.DataBind();
			
		}		
		#endregion

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{			
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		#region Event Handlers

		private void Page_Load(object sender, System.EventArgs e)
		{
			try 
			{				
				if (!Page.IsPostBack) 
				{		
					lnkMore.NavigateUrl = EditUrl("InfoLinkMore");
					BindList();					
				}
			} 
			catch (Exception exc) 
			{
				Exceptions.ProcessModuleLoadException(this, exc);
			}
		}

		#endregion

	}
}